package com.example.zhu95.mytimber.fragments;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.zhu95.mytimber.R;
import com.example.zhu95.mytimber.activity.MainActivity;

/**
 * @author zhu95 on 2017/11/27.
 */

public class BaseFragment extends Fragment {
    protected MainActivity rootActivity;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        rootActivity = (MainActivity) getActivity();
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        setHasOptionsMenu(true);
        return super.onCreateView(inflater, container, savedInstanceState);
    }

    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        super.onCreateOptionsMenu(menu, inflater);
        inflater.inflate(R.menu.main_option_popup, menu);
    }
}
